/*************************************************************************
    > File Name: 1.inet_pton.c
    > Author: Ykk
    > Mail: 3393579535@qq.com 
    > Created Time: 2023年05月15日 星期一 21时31分47秒
 ************************************************************************/

#include<stdio.h>
#include<stdlib.h>
#include<arpa/inet.h>
int main()
{
	char buf[]="192.168.1.1";
	unsigned int num = 0;
	inet_pton(AF_INET,buf,&num);
	unsigned char * p = (unsigned char *)&num;

	printf("%d %d %d %d\n",*p,*(p+1),*(p+2),*(p+3));
	char ip[16] = "";
	printf("%s\n",inet_ntop(AF_INET,&num,ip,16));
	return 0;
}
